*----------------------------------------------------------------------* * Constants *----------------------------------------------------------------------* CONSTANTS: GC_X TYPE C LENGTH 1 VALUE 'X'.
*----------------------------------------------------------------------* * Variables *----------------------------------------------------------------------* DATA: GV_OKCODE TYPE SY-UCOMM, GV_SAVEOK TYPE SY-UCOMM, GV_RAD_ONE TYPE C, GV_RAD_TWO TYPE C.
*----------------------------------------------------------------------* * Structure *----------------------------------------------------------------------* DATA: GS_RADBUT_ONE TYPE SMP_DYNTXT, GS_RADBUT_TWO TYPE SMP_DYNTXT.
*----------------------------------------------------------------------* * Include *----------------------------------------------------------------------* INCLUDE YTEST_PROGRAM_ _TOP. INCLUDE YTEST_PROGRAM_ _SCR. INCLUDE YTEST_PROGRAM_ _CLA. INCLUDE YTEST_PROGRAM_ _PBO. INCLUDE YTEST_PROGRAM_ _PAI. INCLUDE YTEST_PROGRAM_ _F01.
*&---------------------------------------------------------------------* *& Form SET_RADIOBUTTON_STYLE *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> PV_FLAG *& --> PV_TEXT *& <-- PS_RADBUT *&---------------------------------------------------------------------* FORM SET_RADIOBUTTON_STYLE USING VALUE(PV_FLAG) VALUE(PV_TEXT) CHANGING VALUE(PS_RADBUT) TYPE SMP_DYNTXT. *--------------------------Variables-----------------------------------* CONSTANTS: LC_SELECT TYPE ICON-ID VALUE '@TB@', LC_UNSELECT TYPE ICON-ID VALUE '@SR@'. *----------------------------Logic-------------------------------------* PS_RADBUT-ICON_TEXT = PV_TEXT. PS_RADBUT-QUICKINFO = PV_TEXT.
IF PV_FLAG IS NOT INITIAL. PS_RADBUT-ICON_ID = LC_SELECT. ELSE. PS_RADBUT-ICON_ID = LC_UNSELECT. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form USER_COMMAND_0100 *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM USER_COMMAND_0100 . *--------------------------Variables-----------------------------------* CONSTANTS: LC_RADONE TYPE SY-UCOMM VALUE 'RADONE', LC_RADTWO TYPE SY-UCOMM VALUE 'RADTWO'. *----------------------------Logic-------------------------------------* CLEAR: GV_SAVEOK. GV_SAVEOK = GV_OKCODE. CLEAR: GV_OKCODE.
CASE GV_SAVEOK. WHEN LC_RADONE. IF GV_RAD_ONE IS INITIAL. GV_RAD_ONE = GC_X. CLEAR GV_RAD_TWO. ENDIF. WHEN LC_RADTWO. IF GV_RAD_TWO IS INITIAL. GV_RAD_TWO = GC_X. CLEAR GV_RAD_ONE. ENDIF. WHEN OTHERS. ENDCASE. ENDFORM. *&---------------------------------------------------------------------* *& Form EXIT *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM EXIT . *--------------------------Variables-----------------------------------* CONSTANTS: LC_BACK TYPE SY-UCOMM VALUE 'BACK', LC_EXIT TYPE SY-UCOMM VALUE 'EXIT', LC_CANC TYPE SY-UCOMM VALUE 'CANC'. *----------------------------Logic-------------------------------------* CLEAR: GV_SAVEOK. GV_SAVEOK = GV_OKCODE. CLEAR: GV_OKCODE.
CASE GV_SAVEOK. WHEN LC_BACK OR LC_EXIT OR LC_CANC. LEAVE TO SCREEN 0. WHEN OTHERS. ENDCASE. ENDFORM.
*----------------------------------------------------------------------* * Constants *----------------------------------------------------------------------* CONSTANTS: GC_X TYPE C LENGTH 1 VALUE 'X', GC_S TYPE C LENGTH 1 VALUE 'S', GC_E TYPE C LENGTH 1 VALUE 'E', GC_NULL TYPE C LENGTH 1 VALUE ''.
*----------------------------------------------------------------------* * Variables *----------------------------------------------------------------------* DATA: GV_MESSAGE TYPE C, GV_SAVEOK TYPE SY-UCOMM, OK_CODE TYPE SY-UCOMM, GV_RAD_ONE TYPE C, GV_RAD_TWO TYPE C.
*----------------------------------------------------------------------* * Structure *----------------------------------------------------------------------* DATA: BEGIN OF GS_TABLE, FIELD, END OF GS_TABLE.
*----------------------------------------------------------------------* * Internal Table *----------------------------------------------------------------------* DATA: GT_TABLE LIKE TABLE OF GS_TABLE, GT_FIELDCATALOG TYPE LVC_T_FCAT.
*----------------------------------------------------------------------* * Object *----------------------------------------------------------------------* CLASS LCL_EVENTS DEFINITION DEFERRED. DATA: GO_EVENTS TYPE REF TO LCL_EVENTS, GO_ALV TYPE REF TO CL_GUI_ALV_GRID, GO_CONTAINER TYPE REF TO CL_GUI_DOCKING_CONTAINER.
(2)Include CLA
1 2 3 4 5 6 7 8 9 10 11 12
CLASS LCL_EVENTS DEFINITION. PUBLIC SECTION. METHODS: HANDLE_TOOLBAER FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID IMPORTING E_OBJECT E_INTERACTIVE. ENDCLASS.
*&---------------------------------------------------------------------* *& Form HANDLE_TOOLBAER *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& <-- E_OBJECT *& <-- E_INTERACTIVE *&---------------------------------------------------------------------* FORM HANDLE_TOOLBAER CHANGING VALUE(PO_OBJECT) TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET VALUE(PV_INTERACTIVE). *--------------------------Variables-----------------------------------* CONSTANTS: LC_RADONE TYPE SY-UCOMM VALUE 'RADONE', LC_RADTWO TYPE SY-UCOMM VALUE 'RADTWO'. DATA: LS_TOOLBAER TYPE STB_BUTTON, LV_ICON TYPE ICON-NAME. *----------------------------Logic-------------------------------------* "Set the vertical line that distinguishes the button area LS_TOOLBAER-BUTN_TYPE = 3. APPEND LS_TOOLBAER TO PO_OBJECT->MT_TOOLBAR.
"Radio Button One IF GV_RAD_ONE IS NOT INITIAL. PERFORM SET_TOOLBAER USING LC_RADONE ICON_WD_RADIO_BUTTON TEXT-R01 TEXT-R01 CHANGING PO_OBJECT. ELSE. PERFORM SET_TOOLBAER USING LC_RADONE ICON_WD_RADIO_BUTTON_EMPTY TEXT-R01 TEXT-R01 CHANGING PO_OBJECT. ENDIF.
"Radio Button Two IF GV_RAD_TWO IS NOT INITIAL. PERFORM SET_TOOLBAER USING LC_RADONE ICON_WD_RADIO_BUTTON TEXT-R02 TEXT-R02 CHANGING PO_OBJECT. ELSE. PERFORM SET_TOOLBAER USING LC_RADONE ICON_WD_RADIO_BUTTON_EMPTY TEXT-R02 TEXT-R02 CHANGING PO_OBJECT. ENDIF.
ENDFORM. *&---------------------------------------------------------------------* *& Form SET_TOOLBAER *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> PV_FUNC *& --> PV_ICON *& --> PV_QUINFO *& --> PV_TEXT *& <-- PO_OBJECT *&---------------------------------------------------------------------* FORM SET_TOOLBAER USING VALUE(PV_FUNC) VALUE(PV_ICON) VALUE(PV_QUINFO) VALUE(PV_TEXT) CHANGING VALUE(PO_OBJECT) TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET. *--------------------------Variables-----------------------------------* DATA: LS_TOOLBAER TYPE STB_BUTTON. *----------------------------Logic-------------------------------------* CLEAR: LS_TOOLBAER. LS_TOOLBAER-FUNCTION = PV_FUNC. LS_TOOLBAER-ICON = PV_ICON. LS_TOOLBAER-TEXT = PV_TEXT. LS_TOOLBAER-QUICKINFO = PV_QUINFO. APPEND LS_TOOLBAER TO PO_OBJECT->MT_TOOLBAR. ENDFORM.